package com.bestcem.xm.qdes.mq.receiver.biz;

import com.alibaba.fastjson.JSONObject;
import com.bestcem.xm.qdes.mq.dto.StatusDto;
import com.bestcem.xm.qdes.service.QdesMessageReceiverService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ReceiverService {
    private final QdesMessageReceiverService qdesMessageReceiverService;

    public ReceiverService(QdesMessageReceiverService qdesMessageReceiverService) {
        this.qdesMessageReceiverService = qdesMessageReceiverService;
    }

    public void projectUpdated(GenericMessage<StatusDto> msg) {
        qdesMessageReceiverService.projectUpdated(msg.getPayload());
    }

    public void projectDeletedShare(GenericMessage<JSONObject> msg) {
        qdesMessageReceiverService.projectDeletedShare(msg.getPayload());
    }

    public void saveQuestionColumn(GenericMessage<JSONObject> msg) {
        qdesMessageReceiverService.saveQuestionColumn(msg.getPayload());
    }
}
